<?php
//No direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');

class OwnserviceViewShowexchangerate extends JView
{
	function display($tpl=null)
	{
		global $mainframe, $option;
		
		//Initialise variables
		$document 	=& JFactory::getDocument();
		$user		=& JFactory::getUser();
		$owuser		=& Ownservice::getUser();
		$params 	=& $mainframe->getParams('com_ownservice');
		
		//check permission for manage transactions
		if($user->gid < 25) {
			if (!Ownservice::checkAccess( 'showexchangerate', 'view' )) {
				JError::raiseWarning(500, JText::_('ALERTNOTAUTH') );
				$mainframe->redirect(JRoute::_('index.php?option=com_ownservice'));
			}
		}
		
		$filter_order		= $mainframe->getUserStateFromRequest($option.'.showexchangerate.filter_order', 'filter_order', 'r.id', 'cmd');
		$filter_order_Dir	= $mainframe->getUserStateFromRequest($option.'.showexchangerate.filter_order_Dir', 'filter_order_Dir', '', 'cmd');

		//add style to document
		$document->addStyleSheet(JURI::base().'/components/com_ownservice/assets/css/style.css');
		$document->addStyleSheet(JURI::base().'/components/com_ownservice/assets/css/nav.css');
		
		//get data from the model
		$model 		= $this->getModel();
		$rows		= $this->get('Data');
		$pageNav	= $this->get('Pagination');
		
		$lists = array();

		$lists['order']     = $filter_order;
		$lists['order_Dir'] = $filter_order_Dir;

		//set page title
		$params->set('page_title',	JText::_('OWNSERVICE_EXCHANGERATES'));
		$document->setTitle( $params->get('page_title') );
		
		//assign data to document
		$this->assignRef('rows', $rows);
		$this->assignRef('pageNav', $pageNav);
		$this->assignRef('lists', $lists);
		$this->assignRef('user', $user);
		
		parent::display($tpl);
	}
}
